package chapter06.E2;

import java.util.LinkedList;

public class E2 {
    public static void main(String[] args) {
        LinkedList list = new LinkedList();
            list.add("张三");// 向列表中添加String对象
            list.add("李四");
            list.add("王五");
            list.add("赵六");
            System.out.println("list元素个数：" + list.size());
            System.out.println("查看第二个元素：" + list.get(1));
            System.out.println(list);
            list.set(2,"隔壁老王");// 替换指定元素
            System.out.println(list);
            list.remove(2);
            System.out.println(list);
            list.add(Math.PI);// 列表中放入其他对象
            System.out.println(list);
    }
}
